# import network,time
# 连接wifi
def do_connect():
    wlan = network.WLAN(network.STA_IF) # 接入点 
    wlan.active(True) # 激活。如果上次连过，再次激活就默认连上了
    if not wlan.isconnected():
        print('connecting to network...')
        wlan.connect('dongfeiqiu', 'wangmingdong1225') # 名称 密码
        i = 1
        while not wlan.isconnected():
            print("正在链接...{}".format(i))
            i += 1
            time.sleep(1)
    print('network config:', wlan.ifconfig()) # 查看IP